package com.knowif.util.commonUtil;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;

public class HttpUtil {
	
	 public static String getRequest(String api) {
	        String result = "";
	        try {
	            URL url = new URL(api);
	            InputStream in = url.openStream();
	            BufferedReader br = new BufferedReader(new InputStreamReader(in));
	            String temp = "";
	            while((temp = br.readLine())!=null) {
	                result += temp;
	            }
	        } catch (MalformedURLException e) {
	            // TODO Auto-generated catch block
	            e.printStackTrace();
	        } catch (IOException e) {
	            // TODO Auto-generated catch block
	            e.printStackTrace();
	        }
	        return result;
	    }

}
